﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using DAL.Dao;
using DAL;

namespace BLL
{
    public class UserinfoImpl : IDisposable
    {
        private static UserInfoDaoimpl _dao ;
        public int ExistNum { get { return _dao.ExistNum; } private set { } }
        public UserinfoImpl()
        {
            if (_dao == null)
                _dao = new UserInfoDaoimpl();
        }

        public UserInfo Login(string username, string userpass)
        {
            return _dao.Login(username, userpass);
        }
        public IList<UserInfo> GetList()
        {
            return _dao.GetList();
        }

        public UserInfo Find(int id)
        {
            return _dao.Find(id);
        }

        public bool Delete(int id)
        {
            return _dao.Delete(id);
        }

        public bool Update(int id,UserInfo userInfo)
        {
            return  _dao.Update(id,userInfo);
        }
        public bool Add(UserInfo userInfo)
        {
            return _dao.Add(userInfo);
        }

        public (int,IList<UserInfo>) GetList(int rows,int page)
        {
            return _dao.GetList(rows,page);
        }

        public IList<UserInfo> GetUserInfo(int id)
        {
            var rs = _dao.GetUserInfo(id);
            return rs;
        }
        public IList<UserInfo> GetUserInfo(string  username)
        {
            var rs = _dao.GetUserInfo(username);
            return rs;
        }

        public void Dispose()
        {
            _dao.Dispose();
        }

    }
}
